﻿@model System.Collections.Generic.IEnumerable<Tippelde.Services.Dtos.GroupHeaderData>
@{
    ViewBag.Title = "Csoportok";
}

<div class="row">
    <div class="col-md-6">
        <h2>Csoportok</h2>
        <p>
            <a href='@Url.Action("Create", "Group")' class="btn btn-link" data-remote="@Url.Action("Create", "Group", new {partial=true})" data-toggle="modal" data-target="#groupModal">
                <span class="glyphicon glyphicon-plus-sign"></span> Új csoport hozzáadása
            </a>
        </p>
        <table class="table table-striped table-hover">
            <tbody>
                @foreach (var g in Model)
                {
                    <tr>
                        <td>@g.Id</td>
                        <td>@g.Name</td>
                        <td>@g.ShortName</td>
                        <td>
                            <a href='@Url.Action("AssignToGroup", "Group", new { Id = g.Id })'>
                                <span class="glyphicon glyphicon-user" title="Felhasználók"></span>
                            </a>
                            <a href='@Url.Action("Edit", "Group", new { Id = g.Id })' 
                               data-remote="@Url.Action("Edit", "Group", new {Id = g.Id, partial=true})" data-toggle="modal" data-target="#groupModal">
                                <span class="glyphicon glyphicon-edit" title="Szerkesztés"></span>
                            </a>
                            <span>
                                @using (Html.BeginForm("Delete", "Group", FormMethod.Post, new { @class = "form-action-delete inline-submit-form" }))
                                {
                                    @Html.AntiForgeryToken()
                                    @Html.Hidden("Id", g.Id)
                                    <button class='btn btn-link' type="submit" title="Törlés">
                                        <span class='glyphicon glyphicon-remove'></span>
                                    </button>
                                }
                            </span>
                        </td>
                    </tr>
                }
            </tbody>
            <thead>
                <tr><th>Id</th><th>Név</th><th>Rövidítés</th><th>Opciók</th></tr>
            </thead>
        </table>
    </div>
    <div id="groupModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modalTitle" aria-hidden="true">

    </div>
</div>
